package org.davidliebman.android.awesomecube;

public class MeshPartPlaneZ extends MeshPart {

	public MeshPartPlaneZ (int textureID, boolean reversed, float moveX, float moveY, float moveZ, int mShape) {
		super(textureID);
		this.mShape = mShape;
		this.setDistanceVars();
		setupArrays(moveX,moveY,moveZ, reversed);

		
	}
	
	public MeshPartPlaneZ (int textureID, boolean reversed, float moveX, float moveY, float moveZ) {
		
		this.mShape = MeshPart.SHAPE_SQUARE;
		this.setDistanceVars();
		setupArrays(moveX,moveY,moveZ, reversed);

		
	}

	
	public MeshPartPlaneZ(int textureID, boolean reversed,float halfOfDimension, float moveX, float moveY, float moveZ) {
		super(textureID);
		
		mShape = MeshPart.SHAPE_MIRROR;
		this.setDistanceVars();
		
		//float mHalf = halfOfDimension;
		
		this.mDistanceBot = halfOfDimension;
		this.mDistanceLeft = halfOfDimension;
		this.mDistanceRight = halfOfDimension;
		this.mDistanceTop = halfOfDimension;
		this.mDistanceCenter = halfOfDimension;
		
		setupArrays(moveX,moveY,moveZ, reversed);
		

	}
	
	public void setupArrays(float moveX, float moveY, float moveZ, boolean reversed) {
		this.mReverseWinding = reversed;
		
		
		this.mPoints.clear();
		this.add(new PointXYZ ( moveX - this.mDistanceLeft , moveY - this.mDistanceBot, moveZ - mDistanceCenter ), 1.0f, 1.0f);//0
		this.add(new PointXYZ ( moveX - this.mDistanceLeft , moveY + this.mDistanceTop, moveZ - mDistanceCenter ), 1.0f, 0.0f); //1
		this.add(new PointXYZ ( moveX + this.mDistanceRight , moveY - this.mDistanceBot, moveZ - mDistanceCenter ), 0.0f, 1.0f ); //2
		this.add(new PointXYZ ( moveX + this.mDistanceRight , moveY + this.mDistanceTop, moveZ - mDistanceCenter ), 0.0f, 0.0f);  //3
	
		
		this.mIndex.clear();
		this.addIndex((short)0);
		this.addIndex((short)2);
		this.addIndex((short)1);
		this.addIndex((short)2);
		this.addIndex((short)3);
		this.addIndex((short)1);
	}
}

